package com.junzhiit.nengji.app.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.app.service.ShopInfoService;
import com.junzhiit.nengji.app.web.vo.ResultVO;
import com.junzhiit.nengji.app.web.vo.ShopInfoEditVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/shop/info")
public class ShopInfoController extends BaseController{
	
	@Autowired
	private ShopInfoService shopInfoService;
	
	@ApiOperation(value = "获取商户营业信息")
	@RequestMapping(method=RequestMethod.GET)
	public ResultVO findBySessionId(String sessionId){
		return shopInfoService.findBySessionId(sessionId);
	}
	
	@ApiOperation(value = "更新商户营业信息")
	@RequestMapping(method = RequestMethod.PUT)
	public ResultVO update(ShopInfoEditVO shopInfoEditVO) {
		AssertUtil.notBlank(shopInfoEditVO.getSessionId(), "sessionId is required");
		return shopInfoService.update(shopInfoEditVO);
	}
	
	@ApiOperation(value = "删除店铺图片")
	@RequestMapping(method=RequestMethod.DELETE)
	public ResultVO delShopInfoImg(Integer imgType,String sessionId){
		AssertUtil.notBlank(sessionId, "sessionId is required");
		AssertUtil.notNull(imgType, "imgType is required");
		return shopInfoService.delShopInfoImg(imgType,sessionId);
	}

}
